<template>
  <div class="scan">

    <div style="text-align: center;margin-top: 60px;width: 100%;height: 100px;">
      <el-button type="primary" @click="scan()">扫码</el-button>

    </div>
    <e-text style="text-align: center;" v-bind="text">扫码返回:{{text}}</e-text>
  </div>
</template>

<script>
  export default {
    name: "text-scan",
    data() {
      return {
        text: ''
      }
    },

    methods: {
      scan() {
        window.android.scan();
      },
      getScanResult(msg) {
        var content = msg.content;
        this.text = content
      }
    },
    created() {
    },
    mounted() {
      const that = this;
      //将要给原生调用的方法挂载到 window 上面
      window.getScanResult = that.getScanResult;
    }
  }
</script>
